package com.to;

import java.lang.reflect.Field;

public class TestTo {

	private final Integer userId;
	private String name;
	
	
	
	private TestTo(String name){
		this.userId = -1;
		this.setName(name);
		System.out.println(name);
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Integer getUserId() {
		return userId;
	}
	
	
	 public void changeField(String name1, Object value) throws IllegalAccessException, NoSuchFieldException {
		    Field field = TestTo.class.getDeclaredField(name1);
		    field.setAccessible(true);
		    field.set(this, value);
		    System.out.println("reflection: " + name + " = " + field.get(this));
		  }
}
